package com.sun.design.singleton01;

import java.util.HashSet;
import java.util.Set;

public class Singleton01 {
    public static void main(String[] args) {

    }
}
class Singleton{
    private static volatile Singleton singleton;
    private Singleton(){

    }
    public static Singleton getInstance(){
        if (singleton == null){
            synchronized(Singleton.class){
                if (singleton == null){
                    singleton = new Singleton();
                }
            }
        }
        return singleton;
    }
}